package com.rongc.client.freight.business.message.view.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.rongc.client.freight.R;
import com.rongc.client.freight.base.BaseFragment;
import com.rongc.client.freight.base.view.widget.DividerItemDecoration;
import com.rongc.client.freight.business.message.model.MessageBean;
import com.rongc.client.freight.business.message.view.adapter.RecyclerMessageAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;

/**
 * Created by Bruce on 2016/11/24.
 */
public class MessageLeftFragment extends BaseFragment {
    @Bind(R.id.recycler)
    RecyclerView mRvBot;

    RecyclerMessageAdapter mLvAdapter;
    List<MessageBean> lsNews;

    public static MessageLeftFragment getInstance(){
        /*if(fragment == null) fragment = new HomeFragment(orderType);
        return fragment;*/
        MessageLeftFragment fragment = new MessageLeftFragment();
        Bundle bdl = new Bundle();
//        bdl.putString("orderType", orderType);
        fragment.setArguments(bdl);
        return fragment;
    }


    public void setDatas(List<MessageBean> datas){
        this.lsNews = datas;
    }


    @Override
    public void initData() {
    }

    @Override
    public void initListener() {

    }


    @Override
    public void initView() {
        lsNews = new ArrayList<>();

        lsNews.add(new MessageBean());
        lsNews.add(new MessageBean());
        mLvAdapter = new RecyclerMessageAdapter(getActivity(), lsNews);
        mRvBot.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
        mRvBot.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
        mRvBot.setAdapter(mLvAdapter);
    }


    @Override
    public int getLayoutId() {
        return R.layout.universal_recycler_2;
    }
}
